import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
const state={
    loginuserinfo:{}
};
const mutations={
    SET_LOGIN_USER_INFO(state,userinfo){//给state中的loginuserinfo赋值
        state.loginuserinfo=userinfo;
    },
    EDIT_LOGIN_USER_INFO_CLASS(state,classId){// 
        state.loginuserinfo.currentClassId=classId;
    },
    EDIT_LOGIN_USER_INFO_Permid(state,permid){// 
        state.loginuserinfo.permid=permid;
    },

    EDIT_LOGIN_USER_INFO(state,userinfo){// 
        state.loginuserinfo=userinfo;
    }
};
const actions={};
const getters={
    loginuserinfo(state){//获得登录用户的信息
        return state.loginuserinfo;
    }
};
const store=new Vuex.Store({
    strict:true,
    state,//放数据
    mutations,//操作state
    actions,//操作mutations
    getters,//对state操作的计算机属性类似comuted
})
export default store;